package cn.hasayam.test3;


import android.arch.persistence.room.Database;
import android.arch.persistence.room.Room;
import android.arch.persistence.room.RoomDatabase;
import android.content.Context;
import android.util.Log;

@Database(entities = { SettingBean.class }, version = 1,exportSchema = false)
public abstract class SettingDatabase extends RoomDatabase {

    private static final String DB_NAME = "SettingDatabase.db";
    private static volatile SettingDatabase instance;

    public static synchronized SettingDatabase getInstance(Context context) {
        if (instance == null) {
            instance = create(context);
        }
        return instance;
    }

    private static SettingDatabase create(final Context context) {
        return Room.databaseBuilder(
                context,
                SettingDatabase.class,
                DB_NAME).build();
    }

    public abstract SettingDao getSettingDao();
}